﻿@page "/cms/admin/entries"
@using Dignite.Abp.Regionalization
@using Dignite.Cms.Admin.Entries;
@using Dignite.Cms.Admin.Sections;
@using Dignite.Cms.Localization;
@using Dignite.Cms.Permissions;
@using Microsoft.AspNetCore.Authorization;
@using Volo.Abp.AspNetCore.Components.Web.Theming.Layout
@using Volo.Abp.Localization;
@using Volo.Abp.Settings
@inject ISectionAdminAppService SectionAppService
@inject NavigationManager Navigation
@inject IRegionalizationProvider RegionalizationProvider
@attribute [Authorize(CmsAdminPermissions.Entry.Default)]
@inherits AbpCrudPageBase<IEntryAdminAppService, EntryDto, Guid, GetEntriesInput, CreateEntryInput, UpdateEntryInput>


<PageTitle>@L["Entries"]</PageTitle>

@* ************************* PAGE HEADER ************************* *@
<PageHeader Title="@L["Entries"]" BreadcrumbItems="@BreadcrumbItems" Toolbar="@Toolbar"></PageHeader>

@* ************************* PAGE BODY ************************* *@
<Card>
    <CardHeader>
        <Fields>
            <Column ColumnSize="ColumnSize.Is3.OnDesktop">
                <Select TValue="Guid" SelectedValue="@GetListInput.SectionId" SelectedValueChanged="OnSectionChangedAsync">
                    @foreach (var item in Sections)
                    {
                        <SelectItem Value="@item.Id">@item.DisplayName</SelectItem>
                    }
                </Select>
            </Column>
            <Column ColumnSize="ColumnSize.Is3.OnDesktop">
                <Select TValue="string" SelectedValue="@GetListInput.Culture" SelectedValueChanged="@OnCultureChangedAsync">
                    @if (Regionalization!=null)
                    {
                    foreach (var sl in Regionalization.AvailableCultures)
                    {
                        <SelectItem Value="sl">
                            @sl.DisplayName
                        </SelectItem>
                    }
                    }
                </Select>
            </Column>
        </Fields>
    </CardHeader>
    <CardBody>
        @* ************************* DATA GRID ************************* *@
        <ExtensibleDataGrid TItem="EntryDto"
                            Data="@Entities"
                            ReadData="@OnDataGridReadAsync"
                            TotalItems="@TotalCount"
                            ShowPager="true"
                            PageSize="@PageSize"
                            CurrentPage="@CurrentPage"
                            Columns="@EntryManagementTableColumns">
        </ExtensibleDataGrid>
    </CardBody>
</Card>
